<template>
	<view class="container" style="height: 100%;">
		<scroll-view scroll-y style="height: 100%;">
		<block v-for="(sellerInfo, index) in sellerInfoList" :key="index">
			<view class="sellerinfo-card" style="margin-top: 20upx;background-color: #EFF3F4;" @click="clickRouterTo(sellerInfo)">
				<view class='container-item' style="display: flex;justify-content: flex-start;align-items: center;">
					<view class="seller-img" style="width: 100upx;height: 100upx;">
						<image :src="sellerInfo.avatar" mode="aspectFit" style="width: 100%;height:100%"></image>
						
					</view>
					<text class="sellerinfo-title" style="margin-left: 20upx;">{{sellerInfo.nickname?sellerInfo.nickname:'我是商家'}}</text>
				</view>
				
				<view>
					<!-- 使用滚动视图 -->
					<scroll-view scroll-x style="background-color: #EFF3F4;">
						<block v-for="(product, index) in sellerInfo.productList" :key="product.productId">
							<view style="display: inline-block;overflow: hidden;width: 30%;margin-right: 13upx;background-color: #66666;">
								<view style="display: flex;flex-direction: column; width:100%;align-items: center;">
									<image style="width:100%;" mode="widthFix" :src="product.productIcon"></image>
									<text style="text-overflow:ellipsis;overflow:hidden;width: 175upx;">{{product.productName}}</text>
									<text style="text-overflow:ellipsis;overflow:hidden;width: 175upx;">￥{{product.productPrice}}</text>
								</view>
							</view>
						</block>
						
					</scroll-view>
				</view>
			</view>
		</block>
		</scroll-view>
		
	</view>
</template>

<script>
	
	export default {
		props:{
			sellerInfoList: Array
		},
		data() {
			return {
				// sellerInfoList: [
					// {
					// 	avatar: "http://localhost:8009/images/seller/20220311/7eaf04db-58ff-4a22-9157-c88bcbb8106a.png",
					// 	nickname: "大米先生",
					// 	productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 	productId: "8e819b879be55ada4a7516ce37c94dac",
					// 	productList: [
					// 		{
					// 			categoryId: null,
					// 			createTime: null,
					// 			isDeleted: null,
					// 			productDescription: null,
					// 			productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 			productId: "8e819b879be55ada4a7516ce37c94dac",
					// 			productName: "水蒸蛋",
					// 			productPrice: 3.9,
					// 			productStatus: null,
					// 			productStock: 300,
					// 			updateTime: null
					// 		},
					// 		{
					// 			categoryId: null,
					// 			createTime: null,
					// 			isDeleted: null,
					// 			productDescription: null,
					// 			productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 			productId: "8e819b879be55ada4a7516ce37c94dac",
					// 			productName: "水蒸蛋",
					// 			productPrice: 3.9,
					// 			productStatus: null,
					// 			productStock: 300,
					// 			updateTime: null
					// 		},
					// 		{
					// 			categoryId: null,
					// 			createTime: null,
					// 			isDeleted: null,
					// 			productDescription: null,
					// 			productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 			productId: "8e819b879be55ada4a7516ce37c94dac",
					// 			productName: "水蒸蛋",
					// 			productPrice: 3.9,
					// 			productStatus: null,
					// 			productStock: 300,
					// 			updateTime: null
					// 		}	
					// 	],
					// 	productName: "水蒸蛋",
					// 	productPrice: 3.9,
					// 	productStock: 300,
					// 	sellerId: "1354313",
					// 	sort: 123,
					// },
					
					// {
					// 	avatar: "http://localhost:8009/images/seller/20220311/7eaf04db-58ff-4a22-9157-c88bcbb8106a.png",
					// 	nickname: "大米先生",
					// 	productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 	productId: "8e819b879be55ada4a7516ce37c94dac",
					// 	productList: [
					// 		{
					// 			categoryId: null,
					// 			createTime: null,
					// 			isDeleted: null,
					// 			productDescription: null,
					// 			productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 			productId: "8e819b879be55ada4a7516ce37c94dac",
					// 			productName: "水蒸蛋",
					// 			productPrice: 3.9,
					// 			productStatus: null,
					// 			productStock: 300,
					// 			updateTime: null
					// 		}	
					// 	],
					// 	productName: "水蒸蛋",
					// 	productPrice: 3.9,
					// 	productStock: 300,
					// 	sellerId: "1354313",
					// 	sort: 123,
					// },
					
					// {
					// 	avatar: "http://localhost:8009/images/seller/20220311/7eaf04db-58ff-4a22-9157-c88bcbb8106a.png",
					// 	nickname: "大米先生",
					// 	productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 	productId: "8e819b879be55ada4a7516ce37c94dac",
					// 	productList: [
					// 		{
					// 			categoryId: null,
					// 			createTime: null,
					// 			isDeleted: null,
					// 			productDescription: null,
					// 			productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 			productId: "8e819b879be55ada4a7516ce37c94dac",
					// 			productName: "水蒸蛋",
					// 			productPrice: 3.9,
					// 			productStatus: null,
					// 			productStock: 300,
					// 			updateTime: null
					// 		}	
					// 	],
					// 	productName: "水蒸蛋",
					// 	productPrice: 3.9,
					// 	productStock: 300,
					// 	sellerId: "1354313",
					// 	sort: 123,
					// },
					
					// {
					// 	avatar: "http://localhost:8009/images/seller/20220311/7eaf04db-58ff-4a22-9157-c88bcbb8106a.png",
					// 	nickname: "大米先生",
					// 	productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 	productId: "8e819b879be55ada4a7516ce37c94dac",
					// 	productList: [
					// 		{
					// 			categoryId: null,
					// 			createTime: null,
					// 			isDeleted: null,
					// 			productDescription: null,
					// 			productIcon: "http://localhost:8009/images/seller/20220311/f3610b8e-a484-4831-bcc5-a6cb174c5037.webp",
					// 			productId: "8e819b879be55ada4a7516ce37c94dac",
					// 			productName: "水蒸蛋",
					// 			productPrice: 3.9,
					// 			productStatus: null,
					// 			productStock: 300,
					// 			updateTime: null
					// 		}	
					// 	],
					// 	productName: "水蒸蛋",
					// 	productPrice: 3.9,
					// 	productStock: 300,
					// 	sellerId: "1354313",
					// 	sort: 123,
					// },
					
					
				// ]
			}
		},
		methods: {
			/* 点击商家头像进行跳转 */
			clickRouterTo(sellerInfo) {
				// 点击了商家面板,进行跳转到商家信息商品展示
				console.log("点击了商家面板,进行跳转到商家信息商品展示");
				console.log(sellerInfo.sellerId);
				let id = sellerInfo.sellerId;
				console.log(id+"---");
				uni.navigateTo({
					url:`../../pages/sellershow/sellershow?sellerId=`+sellerInfo.sellerId
				})
			},
		}
	}
</script>

<style scoped>
	/* 样式 */
	scroll-view{
		/* width: 100%; */
		/* height: 300rpx; */
		white-space: nowrap;
	}
</style>
